package cn.aitrox.ry.enumtype;

public enum ProcessStatusEnum {

    NOT_START(0, "未开始"),

    PROCESSING(1, "处理中"),

    SUCCESS(2, "处理成功"),

    FAIL(3, "处理失败"),

    PAUSE(4, "暂停");

    private Integer status;

    private String desc;

    ProcessStatusEnum(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public Integer getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static boolean _isSuccess(Integer status) {
        return ProcessStatusEnum.SUCCESS.getStatus().equals(status);
    }

    public static boolean _isNotStart(Integer status) {
        return ProcessStatusEnum.NOT_START.getStatus().equals(status);
    }

    public static boolean _isProcessing(Integer status) {
        return ProcessStatusEnum.PROCESSING.getStatus().equals(status);
    }

    public static boolean _isFail(Integer status) {
        return ProcessStatusEnum.FAIL.getStatus().equals(status);
    }

    public static boolean _isPause(Integer status) {
        return ProcessStatusEnum.PAUSE.getStatus().equals(status);
    }

    public static ProcessStatusEnum getEnum(Integer status) {
        for (ProcessStatusEnum statusEnum : ProcessStatusEnum.values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }

}
